home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 253 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: ldb.han.de!W.FANDRYCH
  2. From: W.FANDRYCH@LDB.han.de (Wolfgang H. A. Fandrych)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: What's so different about 2-D arrays???
  5. Date: 3 Jan 96 12:42:00 +0100
  6. Message-ID: <60BE2pvlvlB@ldb-wf.ldb.HAN.DE>
  7. References: <820451938.20697@fredblog.demon.co.uk>
  8. X-Mailer: CrossPoint v3.02
  9. X-Gateway: ZCONNECT UH ldb.han.de [UUCPfZ V5.69 U002]
  10.  
  11. Hi to all and hi to mark@fredblog.demon.co.uk!
  12.  
  13. On 31.12.95, you wrote about
  14. "What's so different about 2-D arrays???":
  15.  
  16. > //My own chess recorder program
  17. >
  18. > void setup(char pos[8][8])
  19. > {
  20. > int x,y;    
  21. >
  22. >     pos[1][8]=pos[8][8]='r';
  23. > [...]
  24. >
  25. > I have written a similar program since, as a test, which uses a 1-D
  26. > array with no problems.  Can someone help me with this problem.
  27. There's no difference between 1d and 2d arrays except you were very lucky  
  28. when you wrote your other version. If you create an array like
  29. char foo[8];
  30. you've got 8 characters in your array and legal indices range from 0 to 7!
  31. The same is true for your pos[8][8]: your index should be between  
  32. pos[0][0] and pos[7][7].
  33.  
  34. Bye
  35.                 Alwin.
  36. --
  37. If you've got an idea         Wolfgang Hermann Alwin           PGP-Key
  38. for a nice signature                  Fandrych              available on
  39. send email to:                 W.Fandrych@LDB.HAN.DE           request
  40.  
  41.